[Javascript] Linux Ajax (mootools Request.JSON) Header error
Posted
by VDVLeon
on Stack Overflow
See other posts from Stack Overflow
or by VDVLeon
Published on 2010-04-22T13:57:13Z
Indexed on
2010/04/22
15:03 UTC
Read the original article
Hit count: 296
Hi all,
I use the following code to get some json data:
var request = new Request.JSON(
{
'url': sourceURI,
'onSuccess': onPageData
}
);
request.get();
Request.JSON is a class from Mootools (a javascript library).
But on linux (ubuntu on firefox 3.5 and Chrome) the request always fails. So i tried to display the http request ajax is sending. (I used netcat to display it)
The request is like this:
OPTIONS /the+url HTTP/1.1
Host: example.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.3 (KHTML, like Gecko) Chrome/4.0.226.0 Safari/532.3
Referer: http://example.com/ref...
Access-Control-Request-Method: GET
Origin: http://example.com
Access-Control-Request-Headers: X-Request, X-Requested-With, Accept
Accept: */*
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
The HTTP request (first line) is not how it should be:
OPTIONS /the+url HTTP/1.1
It should be:
GET /the+url HTTP/1.1
Does anybody know why this problem is and how to fix it?
© Stack Overflow or respective owner